<?php
namespace app\beautiful\model\member;
use app\beautiful\model\CouponModel;
use app\common\model\CommonModel;

class MemberCouponModel extends CommonModel{
    protected  $name = 'beautiful_member_coupon';
    protected  $pk   = 'member_coupon_id';

    public function getIsExpireAttr($value,$data)
    {
        return $data['valid_end_time']<date("Y-m-d") ? 1 : 0;
    }
    public function coupon(){
        return $this->hasOne(CouponModel::class,'coupon_id','coupon_id');
    }
}
